#### Replication for: The Price of Creativity: A Conjoint Experiment in Copyrights ####
#### Replication for: The Price of Creativity: A Conjoint Experiment in Copyrights ####
#### Replication for: The Price of Creativity: A Conjoint Experiment in Copyrights ####

#### Authors: Jaroslaw Kantorowicz, Elena Kantorowicz-Reznichenko, & Yifat Nahmias 

## Load packages (to install a given package remove # in front of the install.packages command)

# install.packages("tidyverse")
library(tidyverse)
# install.packages("cregg")
library(cregg)
# install.packages("plyr")
library(plyr)
# install.packages("GGally")
library(GGally)
# install.packages("ggpubr")
library(ggpubr)
# install.packages("ggsci")
library(ggsci)
# install.packages("scales")
library(scales)
# install.packages("ggforce")
library(ggforce)

# UK gen population# UK gen population# UK gen population# UK gen population
# UK gen population# UK gen population# UK gen population# UK gen population
# UK gen population# UK gen population# UK gen population# UK gen population
# UK gen population# UK gen population# UK gen population# UK gen population

dataset_uk_pop <- read_rds("data_uk_population.RDS")

# Variable transformations

dataset_uk_pop <- dataset_uk_pop %>% dplyr::rename(reproduce="You.give.us.the.right.to.reproduce.your.photo.in.any.medium") %>% 
  dplyr::rename(issue_copies="You.give.us.the.right.to.issue.copies.and/or.communicate.the.photo.to.the.public") %>% 
  dplyr::rename(create_work="You.give.us.the.right.to.create.a.different.work.based.on.or.derived.from.your.photo") %>% 
  dplyr::rename(name="You.give.us.the.right.to.use.your.photo.without.mentioning.your.name") %>% 
  dplyr::rename(price="Price")

dataset_uk_pop <- dataset_uk_pop %>% mutate(rep=ifelse(reproduce=="Yes", "Y", "N"))
dataset_uk_pop <- dataset_uk_pop %>% mutate(nam=ifelse(name=="Yes", "Yes", "No"))
dataset_uk_pop <- dataset_uk_pop %>% mutate(copies=ifelse(issue_copies=="Yes", "Yep", "Nep"))
dataset_uk_pop <- dataset_uk_pop %>% mutate(create=ifelse(create_work=="Yes", "Ye", "Ne"))
dataset_uk_pop$price <- factor(dataset_uk_pop$price, levels = c("50 GBP", "25 GBP"))

dataset_uk_pop$rep <- as.factor(dataset_uk_pop$rep) 
dataset_uk_pop$nam <- as.factor(dataset_uk_pop$nam)
dataset_uk_pop$copies <- as.factor(dataset_uk_pop$copies) 
dataset_uk_pop$create <- as.factor(dataset_uk_pop$create) 

dataset_uk_pop <- dataset_uk_pop %>% dplyr::rename(right_to_reproduce=rep) %>% 
  dplyr::rename(right_to_use_without_recognition=nam) %>% 
  dplyr::rename(right_to_create_different_work=create) %>% 
  dplyr::rename(right_to_issue_copies=copies)

dataset_uk_pop <- dataset_uk_pop %>% dplyr::rename(responseid=Response.ID)

dataset_uk_pop <- dataset_uk_pop %>% mutate(price, price = revalue(price, c("25 GBP" = " 25"))) %>% 
  mutate(price, price = revalue(price, c("50 GBP" = " 50")))

dataset_uk_pop <- dataset_uk_pop %>% mutate(sample="UK")

dataset_pop <- dataset_uk_pop %>% mutate(sample="General population")

#### AMCE

amce <- cj(dataset_uk_pop, selected ~ 
           price + 
           right_to_use_without_recognition +
           right_to_issue_copies +
           right_to_create_different_work +
           right_to_reproduce, 
         id = ~responseid)

### UK general population graph: AMCE

uk_pop_est <- as.data.frame(amce)

uk_pop_est <- uk_pop_est %>% mutate(attributes=ifelse(feature=="price", "Price",
                                                      ifelse(feature=="right_to_use_without_recognition", "Right to use without attribution",
                                                             ifelse(feature=="right_to_issue_copies", "Right to issue copies",
                                                                    ifelse(feature=="right_to_create_different_work", "Right to create derivative work",
                                                                           ifelse(feature=="right_to_reproduce", "Right to reproduce", NA))))))

uk_pop_est$attribute <- factor(uk_pop_est$attribute, levels = c("Price", 
                                                                "Right to use without attribution",
                                                                "Right to create derivative work",
                                                                "Right to reproduce",
                                                                "Right to issue copies"))

uk_pop_est <- uk_pop_est %>% mutate(levels=ifelse(level=="Nep" | level=="Ne" | level=="N" | level=="No", "No",
                                                  ifelse(level=="Yep" | level=="Ye" | level=="Y" | level=="Yes", "Yes", 
                                                         ifelse(level==" 25", " 25",
                                                                ifelse(level==" 50", " 50", NA)))))

uk_pop_est$levels <- as.factor(uk_pop_est$levels)

uk_pop_est <- uk_pop_est %>% dplyr::rename(term=levels)
uk_pop_est <- uk_pop_est %>% dplyr::rename(conf.low=lower)
uk_pop_est <- uk_pop_est %>% dplyr::rename(conf.high=upper)

# Price attribute

uk_pop_est_price <- uk_pop_est %>% filter(feature=="price")

price <- ggcoef(uk_pop_est_price, vline_color = "gray", conf.int = TRUE,
                mapping = aes(x = estimate, y = term), size = 8,
                vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Price") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_pop_est_price, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0) 

# Right for recognition

uk_pop_est_recognition <- uk_pop_est %>% filter(feature=="right_to_use_without_recognition")

recognition <- ggcoef(uk_pop_est_recognition, vline_color = "gray", conf.int = TRUE,
                      mapping = aes(x = estimate, y = term), size = 8,
                      vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                      sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to use without recognition") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_pop_est_recognition, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0)

# Right to create different work

uk_pop_est_dif_work<- uk_pop_est %>% filter(feature=="right_to_create_different_work")

dif_work <- ggcoef(uk_pop_est_dif_work, vline_color = "gray", conf.int = TRUE,
                   mapping = aes(x = estimate, y = term), size = 8,
                   vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                   sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to create different work") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_pop_est_dif_work, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0)

# Right to reproduce

uk_pop_est_reproduce<- uk_pop_est %>% filter(feature=="right_to_reproduce")

reproduce <- ggcoef(uk_pop_est_reproduce, vline_color = "gray", conf.int = TRUE,
                    mapping = aes(x = estimate, y = term), size = 8,
                    vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                    sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to reproduce") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_pop_est_reproduce, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0) 

# Right to issue copies

uk_pop_est_copies <- uk_pop_est %>% filter(feature=="right_to_issue_copies")

copies <- ggcoef(uk_pop_est_copies, vline_color = "gray", conf.int = TRUE,
                 mapping = aes(x = estimate, y = term), size = 8,
                 vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                 sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to issue copies") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_pop_est_copies, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0) 

figure <- ggarrange(price, recognition, dif_work, reproduce, copies,
                    ncol = 1)

figure <- annotate_figure(figure,
                          bottom = text_grob("AMCEs", size = 25),
                          top = text_grob("A. UK Population \n ", size = 30, face = "bold", just = "centre"))

PAPER_GENERAL_POPULATION_AMCE <- figure

#### MM

mm <- mm(dataset_uk_pop, selected ~ 
           price + 
           right_to_use_without_recognition +
           right_to_issue_copies +
           right_to_create_different_work +
           right_to_reproduce, 
         id = ~responseid)

### UK general population graph: MM

uk_pop_est <- as.data.frame(mm)

uk_pop_est <- uk_pop_est %>% mutate(attributes=ifelse(feature=="price", "Price",
                                                      ifelse(feature=="right_to_use_without_recognition", "Right to use without attribution",
                                                             ifelse(feature=="right_to_issue_copies", "Right to issue copies",
                                                                    ifelse(feature=="right_to_create_different_work", "Right to create derivative work",
                                                                           ifelse(feature=="right_to_reproduce", "Right to reproduce", NA))))))

uk_pop_est$attribute <- factor(uk_pop_est$attribute, levels = c("Price", 
                                                                "Right to use without attribution",
                                                                "Right to create derivative work",
                                                                "Right to reproduce",
                                                                "Right to issue copies"))

uk_pop_est <- uk_pop_est %>% mutate(levels=ifelse(level=="Nep" | level=="Ne" | level=="N" | level=="No", "No",
                                                  ifelse(level=="Yep" | level=="Ye" | level=="Y" | level=="Yes", "Yes", 
                                                         ifelse(level==" 25", " 25",
                                                                ifelse(level==" 50", " 50", NA)))))

uk_pop_est$levels <- as.factor(uk_pop_est$levels)

uk_pop_est <- uk_pop_est %>% dplyr::rename(term=levels)
uk_pop_est <- uk_pop_est %>% dplyr::rename(conf.low=lower)
uk_pop_est <- uk_pop_est %>% dplyr::rename(conf.high=upper)

# Price attribute

uk_pop_est_price <- uk_pop_est %>% filter(feature=="price")

price <- ggcoef(uk_pop_est_price, vline_color = "gray", conf.int = TRUE,
                mapping = aes(x = estimate, y = term), size = 6,
                vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Price") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_pop_est_price, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray") 

# Right for recognition

uk_pop_est_recognition <- uk_pop_est %>% filter(feature=="right_to_use_without_recognition")

recognition <- ggcoef(uk_pop_est_recognition, vline_color = "gray", conf.int = TRUE,
                      mapping = aes(x = estimate, y = term), size = 6,
                      vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                      sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to use without attribution") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_pop_est_recognition, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray")

# Right to create different work

uk_pop_est_dif_work<- uk_pop_est %>% filter(feature=="right_to_create_different_work")

dif_work <- ggcoef(uk_pop_est_dif_work, vline_color = "gray", conf.int = TRUE,
                   mapping = aes(x = estimate, y = term), size = 6,
                   vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                   sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to create derivative work") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_pop_est_dif_work, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray")

# Right to reproduce

uk_pop_est_reproduce<- uk_pop_est %>% filter(feature=="right_to_reproduce")

reproduce <- ggcoef(uk_pop_est_reproduce, vline_color = "gray", conf.int = TRUE,
                    mapping = aes(x = estimate, y = term), size = 6,
                    vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                    sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to reproduce") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_pop_est_reproduce, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray") 

# Right to issue copies

uk_pop_est_copies <- uk_pop_est %>% filter(feature=="right_to_issue_copies")

copies <- ggcoef(uk_pop_est_copies, vline_color = "gray", conf.int = TRUE,
                 mapping = aes(x = estimate, y = term), size = 6,
                 vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                 sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to issue copies") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_pop_est_copies, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray") 

figure <- ggarrange(price, recognition, dif_work, reproduce, copies,
                     ncol = 1)

figure <- annotate_figure(figure,
                           bottom = text_grob("Marignal means (MM)", size = 20))

ggsave(figure, file = "FIGURE_A1.png", 
       width = 10, height = 16, scale = 0.8, dpi = 500)

# UK professionals# UK professionals# UK professionals# UK professionals# UK professionals
# UK professionals# UK professionals# UK professionals# UK professionals# UK professionals
# UK professionals# UK professionals# UK professionals# UK professionals# UK professionals
# UK professionals# UK professionals# UK professionals# UK professionals# UK professionals
# UK professionals# UK professionals# UK professionals# UK professionals# UK professionals

dataset_uk_prof <- read_rds("data_uk_professionals.RDS")

# Variable transformations

dataset_uk_prof <- dataset_uk_prof %>% dplyr::rename(reproduce="You.give.us.the.right.to.reproduce.your.photo.in.any.medium") %>% 
  dplyr::rename(issue_copies="You.give.us.the.right.to.issue.copies.and/or.communicate.the.photo.to.the.public") %>% 
  dplyr::rename(create_work="You.give.us.the.right.to.create.a.different.work.based.on.or.derived.from.your.photo") %>% 
  dplyr::rename(name="You.give.us.the.right.to.use.your.photo.without.mentioning.your.name") %>% 
  dplyr::rename(price="Price")

dataset_uk_prof <- dataset_uk_prof %>% mutate(rep=ifelse(reproduce=="Yes", "Y", "N"))
dataset_uk_prof <- dataset_uk_prof %>% mutate(nam=ifelse(name=="Yes", "Yes", "No"))
dataset_uk_prof <- dataset_uk_prof %>% mutate(copies=ifelse(issue_copies=="Yes", "Yep", "Nep"))
dataset_uk_prof <- dataset_uk_prof %>% mutate(create=ifelse(create_work=="Yes", "Ye", "Ne"))
dataset_uk_prof$price <- factor(dataset_uk_prof$price, levels = c("50 GBP", "25 GBP"))

dataset_uk_prof$rep <- as.factor(dataset_uk_prof$rep) 
dataset_uk_prof$nam <- as.factor(dataset_uk_prof$nam)
dataset_uk_prof$copies <- as.factor(dataset_uk_prof$copies) 
dataset_uk_prof$create <- as.factor(dataset_uk_prof$create) 

dataset_uk_prof <- dataset_uk_prof %>% dplyr::rename(right_to_reproduce=rep) %>% 
  dplyr::rename(right_to_use_without_recognition=nam) %>% 
  dplyr::rename(right_to_create_different_work=create) %>% 
  dplyr::rename(right_to_issue_copies=copies)

dataset_uk_prof <- dataset_uk_prof %>% dplyr::rename(responseid=Response.ID)

dataset_uk_prof <- dataset_uk_prof %>% mutate(price, price = revalue(price, c("25 GBP" = " 25"))) %>% 
  mutate(price, price = revalue(price, c("50 GBP" = " 50")))

dataset_uk_prof <- dataset_uk_prof %>% mutate(sample="UK")

dataset_prof_uk <- dataset_uk_prof %>% mutate(sample="Professionals")

#### AMCE

amce <- cj(dataset_uk_prof, selected ~ 
           price + 
           right_to_use_without_recognition +
           right_to_issue_copies +
           right_to_create_different_work +
           right_to_reproduce, 
         id = ~responseid)

### UK professionals graph: AMCE

uk_prof_est <- as.data.frame(amce)

uk_prof_est <- uk_prof_est %>% mutate(attributes=ifelse(feature=="price", "Price",
                                                      ifelse(feature=="right_to_use_without_recognition", "Right to use without attribution",
                                                             ifelse(feature=="right_to_issue_copies", "Right to issue copies",
                                                                    ifelse(feature=="right_to_create_different_work", "Right to create derivative work",
                                                                           ifelse(feature=="right_to_reproduce", "Right to reproduce", NA))))))

uk_prof_est$attribute <- factor(uk_prof_est$attribute, levels = c("Price", 
                                                                "Right to use without attribution",
                                                                "Right to create derivative work",
                                                                "Right to reproduce",
                                                                "Right to issue copies"))

uk_prof_est <- uk_prof_est %>% mutate(levels=ifelse(level=="Nep" | level=="Ne" | level=="N" | level=="No", "No",
                                                  ifelse(level=="Yep" | level=="Ye" | level=="Y" | level=="Yes", "Yes", 
                                                         ifelse(level==" 25", " 25",
                                                                ifelse(level==" 50", " 50", NA)))))

uk_prof_est$levels <- as.factor(uk_prof_est$levels)

uk_prof_est <- uk_prof_est %>% dplyr::rename(term=levels)
uk_prof_est <- uk_prof_est %>% dplyr::rename(conf.low=lower)
uk_prof_est <- uk_prof_est %>% dplyr::rename(conf.high=upper)

# Price attribute

uk_prof_est_price <- uk_prof_est %>% filter(feature=="price")

price <- ggcoef(uk_prof_est_price, vline_color = "gray", conf.int = TRUE,
                mapping = aes(x = estimate, y = term), size = 8,
                vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Price") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_prof_est_price, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0)

# Right for recognitition

uk_prof_est_recognition <- uk_prof_est %>% filter(feature=="right_to_use_without_recognition")

recognition <- ggcoef(uk_prof_est_recognition, vline_color = "gray", conf.int = TRUE,
                      mapping = aes(x = estimate, y = term), size = 8,
                      vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                      sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to use without recognition") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_prof_est_recognition, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0) 

# Right to create different work

uk_prof_est_dif_work<- uk_prof_est %>% filter(feature=="right_to_create_different_work")

dif_work <- ggcoef(uk_prof_est_dif_work, vline_color = "gray", conf.int = TRUE,
                   mapping = aes(x = estimate, y = term), size = 8,
                   vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                   sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to create different work") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_prof_est_dif_work, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0) 

# Right to reproduce

uk_prof_est_reproduce<- uk_prof_est %>% filter(feature=="right_to_reproduce")

reproduce <- ggcoef(uk_prof_est_reproduce, vline_color = "gray", conf.int = TRUE,
                    mapping = aes(x = estimate, y = term), size = 8,
                    vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                    sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to reproduce") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_prof_est_reproduce, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0) 

# Right to issue copies

uk_prof_est_copies <- uk_prof_est %>% filter(feature=="right_to_issue_copies")

copies <- ggcoef(uk_prof_est_copies, vline_color = "gray", conf.int = TRUE,
                 mapping = aes(x = estimate, y = term), size = 8,
                 vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                 sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to issue copies") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_prof_est_copies, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0) 

figure <- ggarrange(price, recognition, dif_work, reproduce, copies,
                    ncol = 1)

figure <- annotate_figure(figure,
                          bottom = text_grob("AMCEs", size = 25),
                          top = text_grob("A. UK professionals \n ", size = 30, face = "bold", just = "centre"))

PAPER_UK_PROFESSIONAL_AMCE <- figure

#### MM

mm <- mm(dataset_uk_prof, selected ~ 
           price + 
           right_to_use_without_recognition +
           right_to_issue_copies +
           right_to_create_different_work +
           right_to_reproduce, 
         id = ~responseid)

#### UK professionals graph: MM

uk_prof_est <- as.data.frame(mm)

uk_prof_est <- uk_prof_est %>% mutate(attributes=ifelse(feature=="price", "Price",
                                                      ifelse(feature=="right_to_use_without_recognition", "Right to use without attribution",
                                                             ifelse(feature=="right_to_issue_copies", "Right to issue copies",
                                                                    ifelse(feature=="right_to_create_different_work", "Right to create derivative work",
                                                                           ifelse(feature=="right_to_reproduce", "Right to reproduce", NA))))))

uk_prof_est$attribute <- factor(uk_prof_est$attribute, levels = c("Price", 
                                                                "Right to use without attribution",
                                                                "Right to create derivative work",
                                                                "Right to reproduce",
                                                                "Right to issue copies"))

uk_prof_est <- uk_prof_est %>% mutate(levels=ifelse(level=="Nep" | level=="Ne" | level=="N" | level=="No", "No",
                                                  ifelse(level=="Yep" | level=="Ye" | level=="Y" | level=="Yes", "Yes", 
                                                         ifelse(level==" 25", " 25",
                                                                ifelse(level==" 50", " 50", NA)))))

uk_prof_est$levels <- as.factor(uk_prof_est$levels)

uk_prof_est <- uk_prof_est %>% dplyr::rename(term=levels)
uk_prof_est <- uk_prof_est %>% dplyr::rename(conf.low=lower)
uk_prof_est <- uk_prof_est %>% dplyr::rename(conf.high=upper)

# Price attribute

uk_prof_est_price <- uk_prof_est %>% filter(feature=="price")

price <- ggcoef(uk_prof_est_price, vline_color = "gray", conf.int = TRUE,
                mapping = aes(x = estimate, y = term), size = 6,
                vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Price") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_prof_est_price, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray") 

# Right for recognitition

uk_prof_est_recognition <- uk_prof_est %>% filter(feature=="right_to_use_without_recognition")

recognition <- ggcoef(uk_prof_est_recognition, vline_color = "gray", conf.int = TRUE,
                      mapping = aes(x = estimate, y = term), size = 6,
                      vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                      sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to use without attribution") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_prof_est_recognition, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray")

# Right to create different work

uk_prof_est_dif_work<- uk_prof_est %>% filter(feature=="right_to_create_different_work")

dif_work <- ggcoef(uk_prof_est_dif_work, vline_color = "gray", conf.int = TRUE,
                   mapping = aes(x = estimate, y = term), size = 6,
                   vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                   sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to create derivative work") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_prof_est_dif_work, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray")

# Right to reproduce

uk_prof_est_reproduce<- uk_prof_est %>% filter(feature=="right_to_reproduce")

reproduce <- ggcoef(uk_prof_est_reproduce, vline_color = "gray", conf.int = TRUE,
                    mapping = aes(x = estimate, y = term), size = 6,
                    vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                    sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to reproduce") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_prof_est_reproduce, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray") 

# Right to issue copies

uk_prof_est_copies <- uk_prof_est %>% filter(feature=="right_to_issue_copies")

copies <- ggcoef(uk_prof_est_copies, vline_color = "gray", conf.int = TRUE,
                 mapping = aes(x = estimate, y = term), size = 6,
                 vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                 sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to issue copies") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_prof_est_copies, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray") 

figure <- ggarrange(price, recognition, dif_work, reproduce, copies,
                     ncol = 1)

figure <- annotate_figure(figure,
                           bottom = text_grob("Marignal means (MM)", size = 20))

ggsave(figure, file = "FIGURE_A2.png", 
       width = 10, height = 16, scale = 0.8, dpi = 500)

# US professionals# US professionals# US professionals# US professionals# US professionals
# US professionals# US professionals# US professionals# US professionals# US professionals
# US professionals# US professionals# US professionals# US professionals# US professionals
# US professionals# US professionals# US professionals# US professionals# US professionals
# US professionals# US professionals# US professionals# US professionals# US professionals
# US professionals# US professionals# US professionals# US professionals# US professionals

dataset_us_prof <- read_rds("data_us_professionals.RDS")

# Variable transformations

dataset_us_prof <- dataset_us_prof %>% dplyr::rename(reproduce="You.give.us.the.right.to.reproduce.your.photo.in.any.medium") %>% 
  dplyr::rename(issue_copies="You.give.us.the.right.to.issue.copies.and/or.communicate.the.photo.to.the.public") %>% 
  dplyr::rename(create_work="You.give.us.the.right.to.create.a.different.work.based.on.or.derived.from.your.photo") %>% 
  dplyr::rename(name="You.give.us.the.right.to.use.your.photo.without.mentioning.your.name") %>% 
  dplyr::rename(price="Price")

dataset_us_prof <- dataset_us_prof %>% mutate(rep=ifelse(reproduce=="Yes", "Y", "N"))
dataset_us_prof <- dataset_us_prof %>% mutate(nam=ifelse(name=="Yes", "Yes", "No"))
dataset_us_prof <- dataset_us_prof %>% mutate(copies=ifelse(issue_copies=="Yes", "Yep", "Nep"))
dataset_us_prof <- dataset_us_prof %>% mutate(create=ifelse(create_work=="Yes", "Ye", "Ne"))
dataset_us_prof$price <- factor(dataset_us_prof$price, levels = c("50 USD", "25 USD"))

dataset_us_prof$rep <- as.factor(dataset_us_prof$rep) 
dataset_us_prof$nam <- as.factor(dataset_us_prof$nam)
dataset_us_prof$copies <- as.factor(dataset_us_prof$copies) 
dataset_us_prof$create <- as.factor(dataset_us_prof$create) 

dataset_us_prof <- dataset_us_prof %>% dplyr::rename(right_to_reproduce=rep) %>% 
  dplyr::rename(right_to_use_without_recognition=nam) %>% 
  dplyr::rename(right_to_create_different_work=create) %>% 
  dplyr::rename(right_to_issue_copies=copies)

dataset_us_prof <- dataset_us_prof %>% dplyr::rename(responseid=Response.ID)

dataset_us_prof <- dataset_us_prof %>% mutate(price, price = revalue(price, c("25 USD" = " 25"))) %>% 
  mutate(price, price = revalue(price, c("50 USD" = " 50")))

dataset_us_prof <- dataset_us_prof %>% mutate(sample="US")

dataset_prof_us <- dataset_us_prof %>% mutate(sample="Professionals")

#### AMCE

amce <- cj(dataset_us_prof, selected ~ 
           price + 
           right_to_use_without_recognition +
           right_to_issue_copies +
           right_to_create_different_work +
           right_to_reproduce, 
         id = ~responseid)

### US professionals: AMCE

us_prof_est <- as.data.frame(amce)

us_prof_est <- us_prof_est %>% mutate(attributes=ifelse(feature=="price", "Price",
                                                      ifelse(feature=="right_to_use_without_recognition", "Right to use without attribution",
                                                             ifelse(feature=="right_to_issue_copies", "Right to issue copies",
                                                                    ifelse(feature=="right_to_create_different_work", "Right to create derivative work",
                                                                           ifelse(feature=="right_to_reproduce", "Right to reproduce", NA))))))

us_prof_est$attribute <- factor(us_prof_est$attribute, levels = c("Price", 
                                                                "Right to use without attribution",
                                                                "Right to create derivative work",
                                                                "Right to reproduce",
                                                                "Right to issue copies"))

us_prof_est <- us_prof_est %>% mutate(levels=ifelse(level=="Nep" | level=="Ne" | level=="N" | level=="No", "No",
                                                  ifelse(level=="Yep" | level=="Ye" | level=="Y" | level=="Yes", "Yes", 
                                                         ifelse(level==" 25", " 25",
                                                                ifelse(level==" 50", " 50", NA)))))

us_prof_est$levels <- as.factor(us_prof_est$levels)

us_prof_est <- us_prof_est %>% dplyr::rename(term=levels)
us_prof_est <- us_prof_est %>% dplyr::rename(conf.low=lower)
us_prof_est <- us_prof_est %>% dplyr::rename(conf.high=upper)

# Price attribute

us_prof_est_price <- us_prof_est %>% filter(feature=="price")

price <- ggcoef(us_prof_est_price, vline_color = "gray", conf.int = TRUE,
                mapping = aes(x = estimate, y = term), size = 8,
                vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Price") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(us_prof_est_price, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0) +
  labs(y = NULL) +
  guides(y = "none")

# Right for recognitition

us_prof_est_recognition <- us_prof_est %>% filter(feature=="right_to_use_without_recognition")

recognition <- ggcoef(us_prof_est_recognition, vline_color = "gray", conf.int = TRUE,
                      mapping = aes(x = estimate, y = term), size = 8,
                      vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                      sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to use without recognition") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(us_prof_est_recognition, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0) +
  labs(y = NULL) +
  guides(y = "none")

# Right to create different work

us_prof_est_dif_work<- us_prof_est %>% filter(feature=="right_to_create_different_work")

dif_work <- ggcoef(us_prof_est_dif_work, vline_color = "gray", conf.int = TRUE,
                   mapping = aes(x = estimate, y = term), size = 8,
                   vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                   sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to create different work") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(us_prof_est_dif_work, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0) +
  labs(y = NULL) +
  guides(y = "none")

# Right to reproduce

us_prof_est_reproduce<- us_prof_est %>% filter(feature=="right_to_reproduce")

reproduce <- ggcoef(us_prof_est_reproduce, vline_color = "gray", conf.int = TRUE,
                    mapping = aes(x = estimate, y = term), size = 8,
                    vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                    sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to reproduce") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(us_prof_est_reproduce, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0) +
  labs(y = NULL) +
  guides(y = "none")

# Right to issue copies

us_prof_est_copies <- us_prof_est %>% filter(feature=="right_to_issue_copies")

copies <- ggcoef(us_prof_est_copies, vline_color = "gray", conf.int = TRUE,
                 mapping = aes(x = estimate, y = term), size = 8,
                 vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                 sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to issue copies") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(us_prof_est_copies, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0) +
  labs(y = NULL) +
  guides(y = "none")

figure <- ggarrange(price, recognition, dif_work, reproduce, copies,
                    ncol = 1)

figure <- annotate_figure(figure,
                          bottom = text_grob("AMCEs", size = 25),
                          top = text_grob("B. US Professionals \n ", size = 30, face = "bold", just = "centre"))

PAPER_US_PROFESSIONALS_AMCE <- figure

#### MM

mm <- mm(dataset_us_prof, selected ~ 
           price + 
           right_to_use_without_recognition +
           right_to_issue_copies +
           right_to_create_different_work +
           right_to_reproduce, 
         id = ~responseid)

### US professionals: MM

us_prof_est <- as.data.frame(mm)

us_prof_est <- us_prof_est %>% mutate(attributes=ifelse(feature=="price", "Price",
                                                      ifelse(feature=="right_to_use_without_recognition", "Right to use without attribution",
                                                             ifelse(feature=="right_to_issue_copies", "Right to issue copies",
                                                                    ifelse(feature=="right_to_create_different_work", "Right to create derivative work",
                                                                           ifelse(feature=="right_to_reproduce", "Right to reproduce", NA))))))

us_prof_est$attribute <- factor(us_prof_est$attribute, levels = c("Price", 
                                                                "Right to use without attribution",
                                                                "Right to create derivative work",
                                                                "Right to reproduce",
                                                                "Right to issue copies"))

us_prof_est <- us_prof_est %>% mutate(levels=ifelse(level=="Nep" | level=="Ne" | level=="N" | level=="No", "No",
                                                  ifelse(level=="Yep" | level=="Ye" | level=="Y" | level=="Yes", "Yes", 
                                                         ifelse(level==" 25", " 25",
                                                                ifelse(level==" 50", " 50", NA)))))

us_prof_est$levels <- as.factor(us_prof_est$levels)

us_prof_est <- us_prof_est %>% dplyr::rename(term=levels)
us_prof_est <- us_prof_est %>% dplyr::rename(conf.low=lower)
us_prof_est <- us_prof_est %>% dplyr::rename(conf.high=upper)

# Price attribute

us_prof_est_price <- us_prof_est %>% filter(feature=="price")

price <- ggcoef(us_prof_est_price, vline_color = "gray", conf.int = TRUE,
                mapping = aes(x = estimate, y = term), size = 6,
                vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Price") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(us_prof_est_price, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray") 

# Right for recognitition

us_prof_est_recognition <- us_prof_est %>% filter(feature=="right_to_use_without_recognition")

recognition <- ggcoef(us_prof_est_recognition, vline_color = "gray", conf.int = TRUE,
                      mapping = aes(x = estimate, y = term), size = 6,
                      vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                      sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to use without attribution") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(us_prof_est_recognition, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray")

# Right to create different work

us_prof_est_dif_work<- us_prof_est %>% filter(feature=="right_to_create_different_work")

dif_work <- ggcoef(us_prof_est_dif_work, vline_color = "gray", conf.int = TRUE,
                   mapping = aes(x = estimate, y = term), size = 6,
                   vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                   sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to create derivative work") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(us_prof_est_dif_work, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray")

# Right to reproduce

us_prof_est_reproduce<- us_prof_est %>% filter(feature=="right_to_reproduce")

reproduce <- ggcoef(us_prof_est_reproduce, vline_color = "gray", conf.int = TRUE,
                    mapping = aes(x = estimate, y = term), size = 6,
                    vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                    sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to reproduce") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(us_prof_est_reproduce, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray") 

# Right to issue copies

us_prof_est_copies <- us_prof_est %>% filter(feature=="right_to_issue_copies")

copies <- ggcoef(us_prof_est_copies, vline_color = "gray", conf.int = TRUE,
                 mapping = aes(x = estimate, y = term), size = 6,
                 vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                 sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to issue copies") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(us_prof_est_copies, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray") 

figure <- ggarrange(price, recognition, dif_work, reproduce, copies,
                     ncol = 1)

figure <- annotate_figure(figure,
                           bottom = text_grob("Marignal means (MM)", size = 20))

ggsave(figure, file = "FIGURE_A3.png", 
       width = 10, height = 16, scale = 0.8, dpi = 500)

# Differences UK vs US professionals# Differences UK vs US professionals# Differences UK vs US professionals
# Differences UK vs US professionals# Differences UK vs US professionals# Differences UK vs US professionals
# Differences UK vs US professionals# Differences UK vs US professionals# Differences UK vs US professionals
# Differences UK vs US professionals# Differences UK vs US professionals# Differences UK vs US professionals
# Differences UK vs US professionals# Differences UK vs US professionals# Differences UK vs US professionals
# Differences UK vs US professionals# Differences UK vs US professionals# Differences UK vs US professionals

dataset_prof <- rbind(dataset_uk_prof, dataset_us_prof)

dataset_prof$sample <- as.factor(dataset_prof$sample) 

amce_diff <- cj(dataset_prof, 
                selected ~ 
                  price + 
                  right_to_use_without_recognition +
                  right_to_issue_copies +
                  right_to_create_different_work +
                  right_to_reproduce, 
                by = ~ sample, 
                id = ~ responseid,
                estimate = "amce_diff")

amce_diff <- as.data.frame(amce_diff)

amce_diff <- amce_diff %>% mutate(attributes=ifelse(feature=="price", "Price",
                                                    ifelse(feature=="right_to_use_without_recognition", "Right to use without attribution",
                                                           ifelse(feature=="right_to_issue_copies", "Right to issue copies",
                                                                  ifelse(feature=="right_to_create_different_work", "Right to create derivative work",
                                                                         ifelse(feature=="right_to_reproduce", "Right to reproduce", NA))))))

amce_diff$attribute <- factor(amce_diff$attribute, levels = c("Price", 
                                                              "Right to use without attribution",
                                                              "Right to create derivative work",
                                                              "Right to reproduce",
                                                              "Right to issue copies"))

amce_diff <- amce_diff %>% mutate(levels=ifelse(level=="Nep" | level=="Ne" | level=="N" | level=="No", "No",
                                                ifelse(level=="Yep" | level=="Ye" | level=="Y" | level=="Yes", "Yes", 
                                                       ifelse(level==" 25", " 25",
                                                              ifelse(level==" 50", " 50", NA)))))

amce_diff$levels <- as.factor(amce_diff$levels)

amce_diff <- amce_diff %>% dplyr::rename(term=levels)
amce_diff <- amce_diff %>% dplyr::rename(conf.low=lower)
amce_diff <- amce_diff %>% dplyr::rename(conf.high=upper)

prof_est <- amce_diff

# Price attribute

prof_est_price <- prof_est %>% filter(feature=="price")

price <- ggcoef(prof_est_price, vline_color = "gray", conf.int = TRUE,
                mapping = aes(x = estimate, y = term), size = 8,
                vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Price") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(prof_est_price, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") +
  labs(y = NULL) +
  guides(y = "none")

# Right for recognitition

prof_est_recognition <- prof_est %>% filter(feature=="right_to_use_without_recognition")

recognition <- ggcoef(prof_est_recognition, vline_color = "gray", conf.int = TRUE,
                      mapping = aes(x = estimate, y = term), size = 8,
                      vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                      sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to use without attribution") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(prof_est_recognition, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") +
  labs(y = NULL) +
  guides(y = "none") 

# Right to create different work

prof_est_dif_work<- prof_est %>% filter(feature=="right_to_create_different_work")

dif_work <- ggcoef(prof_est_dif_work, vline_color = "gray", conf.int = TRUE,
                   mapping = aes(x = estimate, y = term), size = 8,
                   vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                   sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to create derivative work") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(prof_est_dif_work, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") +
  labs(y = NULL) +
  guides(y = "none")

# Right to reproduce

prof_est_reproduce<- prof_est %>% filter(feature=="right_to_reproduce")

reproduce <- ggcoef(prof_est_reproduce, vline_color = "gray", conf.int = TRUE,
                    mapping = aes(x = estimate, y = term), size = 8,
                    vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                    sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to reproduce") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(prof_est_reproduce, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") +
  labs(y = NULL) +
  guides(y = "none")

# Right to issue copies

prof_est_copies <- prof_est %>% filter(feature=="right_to_issue_copies")

copies <- ggcoef(prof_est_copies, vline_color = "gray", conf.int = TRUE,
                 mapping = aes(x = estimate, y = term), size = 8,
                 vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                 sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to issue copies") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(prof_est_copies, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") +
  labs(y = NULL) +
  guides(y = "none")

figure <- ggarrange(price, recognition, dif_work, reproduce, copies,
                     ncol = 1)

figure <- annotate_figure(figure,
                           bottom = text_grob("Diff. in AMCEs: US - UK", size = 25),
                           top = text_grob("C. Difference between \nUS and UK", size = 30, face = "bold"))

PAPER_PROFESSIONALS_AMCE_DIFF <- figure

###### COMBINED GRAPH PROFESSIONALS

### Figure 3 in the manuscript

FIGURE_3 <- ggarrange(PAPER_UK_PROFESSIONAL_AMCE, NULL, 
                      PAPER_US_PROFESSIONALS_AMCE, NULL,
                      PAPER_PROFESSIONALS_AMCE_DIFF, 
                      nrow = 1, widths = c(1.1, 0.2, 1, 0.2, 1))

ggsave(FIGURE_3, file = "FIGURE_3.png", 
       width = 12, height = 12, scale = 1.3, bg = "white", dpi = 500)

# Professionals combined # Professionals combined # Professionals combined # Professionals combined 
# Professionals combined # Professionals combined # Professionals combined # Professionals combined 
# Professionals combined # Professionals combined # Professionals combined # Professionals combined 
# Professionals combined # Professionals combined # Professionals combined # Professionals combined 
# Professionals combined # Professionals combined # Professionals combined # Professionals combined 

dataset_prof <- rbind(dataset_uk_prof, dataset_us_prof)

#### AMCE

amce <- cj(dataset_prof, selected ~ 
           price + 
           right_to_use_without_recognition +
           right_to_issue_copies +
           right_to_create_different_work +
           right_to_reproduce, 
         id = ~responseid)

### Professionals graph: AMCE

prof_est <- as.data.frame(amce)

prof_est <- prof_est %>% mutate(attributes=ifelse(feature=="price", "Price",
                                                      ifelse(feature=="right_to_use_without_recognition", "Right to use without attribution",
                                                             ifelse(feature=="right_to_issue_copies", "Right to issue copies",
                                                                    ifelse(feature=="right_to_create_different_work", "Right to create derivative work",
                                                                           ifelse(feature=="right_to_reproduce", "Right to reproduce", NA))))))

prof_est$attribute <- factor(prof_est$attribute, levels = c("Price", 
                                                                "Right to use without attribution",
                                                                "Right to create derivative work",
                                                                "Right to reproduce",
                                                                "Right to issue copies"))

prof_est <- prof_est %>% mutate(levels=ifelse(level=="Nep" | level=="Ne" | level=="N" | level=="No", "No",
                                                  ifelse(level=="Yep" | level=="Ye" | level=="Y" | level=="Yes", "Yes", 
                                                         ifelse(level==" 25", " 25",
                                                                ifelse(level==" 50", " 50", NA)))))

prof_est$levels <- as.factor(prof_est$levels)

prof_est <- prof_est %>% dplyr::rename(term=levels)
prof_est <- prof_est %>% dplyr::rename(conf.low=lower)
prof_est <- prof_est %>% dplyr::rename(conf.high=upper)

# Price attribute

prof_est_price <- prof_est %>% filter(feature=="price")

price <- ggcoef(prof_est_price, vline_color = "gray", conf.int = TRUE,
                mapping = aes(x = estimate, y = term), size = 8,
                vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Price") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(prof_est_price, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0) +
  labs(y = NULL) +
  guides(y = "none")

# Right for recognitition

prof_est_recognition <- prof_est %>% filter(feature=="right_to_use_without_recognition")

recognition <- ggcoef(prof_est_recognition, vline_color = "gray", conf.int = TRUE,
                      mapping = aes(x = estimate, y = term), size = 8,
                      vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                      sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to use without recognition") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(prof_est_recognition, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0) +
  labs(y = NULL) +
  guides(y = "none")

# Right to create different work

prof_est_dif_work<- prof_est %>% filter(feature=="right_to_create_different_work")

dif_work <- ggcoef(prof_est_dif_work, vline_color = "gray", conf.int = TRUE,
                   mapping = aes(x = estimate, y = term), size = 8,
                   vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                   sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to create different work") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(prof_est_dif_work, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0) +
  labs(y = NULL) +
  guides(y = "none")

# Right to reproduce

prof_est_reproduce<- prof_est %>% filter(feature=="right_to_reproduce")

reproduce <- ggcoef(prof_est_reproduce, vline_color = "gray", conf.int = TRUE,
                    mapping = aes(x = estimate, y = term), size = 8,
                    vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                    sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to reproduce") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(prof_est_reproduce, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0) +
  labs(y = NULL) +
  guides(y = "none")

# Right to issue copies

prof_est_copies <- prof_est %>% filter(feature=="right_to_issue_copies")

copies <- ggcoef(prof_est_copies, vline_color = "gray", conf.int = TRUE,
                 mapping = aes(x = estimate, y = term), size = 8,
                 vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                 sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to issue copies") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(prof_est_copies, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.3, 0) +
  labs(y = NULL) +
  guides(y = "none")

figure <- ggarrange(price, recognition, dif_work, reproduce, copies,
                    ncol = 1)

figure <- annotate_figure(figure,
                          bottom = text_grob("AMCEs", size = 25),
                          top = text_grob("B. Professionals \n(combined)", size = 30, face = "bold", just = "center"))

PAPER_PROFESSIONALS_AMCE <- figure

#### MM

mm <- mm(dataset_prof, selected ~ 
           price + 
           right_to_use_without_recognition +
           right_to_issue_copies +
           right_to_create_different_work +
           right_to_reproduce, 
         id = ~responseid)

### Professionals graph: MM

prof_est <- as.data.frame(mm)

prof_est <- prof_est %>% mutate(attributes=ifelse(feature=="price", "Price",
                                                      ifelse(feature=="right_to_use_without_recognition", "Right to use without attribution",
                                                             ifelse(feature=="right_to_issue_copies", "Right to issue copies",
                                                                    ifelse(feature=="right_to_create_different_work", "Right to create derivative work",
                                                                           ifelse(feature=="right_to_reproduce", "Right to reproduce", NA))))))

prof_est$attribute <- factor(prof_est$attribute, levels = c("Price", 
                                                                "Right to use without attribution",
                                                                "Right to create derivative work",
                                                                "Right to reproduce",
                                                                "Right to issue copies"))

prof_est <- prof_est %>% mutate(levels=ifelse(level=="Nep" | level=="Ne" | level=="N" | level=="No", "No",
                                                  ifelse(level=="Yep" | level=="Ye" | level=="Y" | level=="Yes", "Yes", 
                                                         ifelse(level==" 25", " 25",
                                                                ifelse(level==" 50", " 50", NA)))))

prof_est$levels <- as.factor(prof_est$levels)

prof_est <- prof_est %>% dplyr::rename(term=levels)
prof_est <- prof_est %>% dplyr::rename(conf.low=lower)
prof_est <- prof_est %>% dplyr::rename(conf.high=upper)

# Price attribute

prof_est_price <- prof_est %>% filter(feature=="price")

price <- ggcoef(prof_est_price, vline_color = "gray", conf.int = TRUE,
                mapping = aes(x = estimate, y = term), size = 6,
                vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Price") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(prof_est_price, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray") 

# Right for recognitition

prof_est_recognition <- prof_est %>% filter(feature=="right_to_use_without_recognition")

recognition <- ggcoef(prof_est_recognition, vline_color = "gray", conf.int = TRUE,
                      mapping = aes(x = estimate, y = term), size = 6,
                      vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                      sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to use without attribution") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(prof_est_recognition, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray")

# Right to create different work

prof_est_dif_work<- prof_est %>% filter(feature=="right_to_create_different_work")

dif_work <- ggcoef(prof_est_dif_work, vline_color = "gray", conf.int = TRUE,
                   mapping = aes(x = estimate, y = term), size = 6,
                   vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                   sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to create derivative work") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(prof_est_dif_work, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray")

# Right to reproduce

prof_est_reproduce<- prof_est %>% filter(feature=="right_to_reproduce")

reproduce <- ggcoef(prof_est_reproduce, vline_color = "gray", conf.int = TRUE,
                    mapping = aes(x = estimate, y = term), size = 6,
                    vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                    sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to reproduce") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(prof_est_reproduce, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray") 

# Right to issue copies

prof_est_copies <- prof_est %>% filter(feature=="right_to_issue_copies")

copies <- ggcoef(prof_est_copies, vline_color = "gray", conf.int = TRUE,
                 mapping = aes(x = estimate, y = term), size = 6,
                 vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                 sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to issue copies") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(prof_est_copies, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(0.3, 0.7) + 
  geom_vline(xintercept=0.50, color = "gray") 

figure <- ggarrange(price, recognition, dif_work, reproduce, copies,
                     ncol = 1)

figure <- annotate_figure(figure,
                           bottom = text_grob("Marignal means (MM)", size = 20))

ggsave(figure, file = "FIGURE_A4.png", 
       width = 10, height = 16, scale = 0.8, dpi = 500)

### General population vs professionals### General population vs professionals### General population vs professionals
### General population vs professionals### General population vs professionals### General population vs professionals
### General population vs professionals### General population vs professionals### General population vs professionals
### General population vs professionals### General population vs professionals### General population vs professionals
### General population vs professionals### General population vs professionals### General population vs professionals

dataset_prof_pop <- rbind(dataset_pop, dataset_prof_uk, dataset_prof_us)

dataset_prof_pop$sample <- as.factor(dataset_prof_pop$sample) 

ftable(dataset_prof_pop$sample)

amce_diff <- cj(dataset_prof_pop, 
                selected ~ 
                  price + 
                  right_to_use_without_recognition +
                  right_to_issue_copies +
                  right_to_create_different_work +
                  right_to_reproduce, 
                by = ~ sample, 
                id = ~ responseid,
                estimate = "amce_diff")

amce_diff <- as.data.frame(amce_diff)

amce_diff <- amce_diff %>% mutate(attributes=ifelse(feature=="price", "Price",
                                                    ifelse(feature=="right_to_use_without_recognition", "Right to use without attribution",
                                                           ifelse(feature=="right_to_issue_copies", "Right to issue copies",
                                                                  ifelse(feature=="right_to_create_different_work", "Right to create derivative work",
                                                                         ifelse(feature=="right_to_reproduce", "Right to reproduce", NA))))))

amce_diff$attribute <- factor(amce_diff$attribute, levels = c("Price", 
                                                              "Right to use without attribution",
                                                              "Right to create derivative work",
                                                              "Right to reproduce",
                                                              "Right to issue copies"))

amce_diff <- amce_diff %>% mutate(levels=ifelse(level=="Nep" | level=="Ne" | level=="N" | level=="No", "No",
                                                ifelse(level=="Yep" | level=="Ye" | level=="Y" | level=="Yes", "Yes", 
                                                       ifelse(level==" 25", " 25",
                                                              ifelse(level==" 50", " 50", NA)))))

amce_diff$levels <- as.factor(amce_diff$levels)

amce_diff <- amce_diff %>% dplyr::rename(term=levels)
amce_diff <- amce_diff %>% dplyr::rename(conf.low=lower)
amce_diff <- amce_diff %>% dplyr::rename(conf.high=upper)

pop_prof_est <- amce_diff

# Price attribute

pop_prof_est_price <- pop_prof_est %>% filter(feature=="price")

price <- ggcoef(pop_prof_est_price, vline_color = "gray", conf.int = TRUE,
                mapping = aes(x = estimate, y = term), size = 8,
                vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Price") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(pop_prof_est_price, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") +
  labs(y = NULL) +
  guides(y = "none")

# Right for recognition

pop_prof_est_recognition <- pop_prof_est %>% filter(feature=="right_to_use_without_recognition")

recognition <- ggcoef(pop_prof_est_recognition, vline_color = "gray", conf.int = TRUE,
                      mapping = aes(x = estimate, y = term), size = 8,
                      vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                      sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to use without attribution") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(pop_prof_est_recognition, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") +
  labs(y = NULL) +
  guides(y = "none")

# Right to create different work

pop_prof_est_dif_work<- pop_prof_est %>% filter(feature=="right_to_create_different_work")

dif_work <- ggcoef(pop_prof_est_dif_work, vline_color = "gray", conf.int = TRUE,
                   mapping = aes(x = estimate, y = term), size = 8,
                   vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                   sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to create derivative work") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(pop_prof_est_dif_work, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") +
  labs(y = NULL) +
  guides(y = "none")

# Right to reproduce

pop_prof_est_reproduce<- pop_prof_est %>% filter(feature=="right_to_reproduce")

reproduce <- ggcoef(pop_prof_est_reproduce, vline_color = "gray", conf.int = TRUE,
                    mapping = aes(x = estimate, y = term), size = 8,
                    vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                    sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to reproduce") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(pop_prof_est_reproduce, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") +
  labs(y = NULL) +
  guides(y = "none")

# Right to issue copies

pop_prof_est_copies <- pop_prof_est %>% filter(feature=="right_to_issue_copies")

copies <- ggcoef(pop_prof_est_copies, vline_color = "gray", conf.int = TRUE,
                 mapping = aes(x = estimate, y = term), size = 8,
                 vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                 sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to issue copies") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(pop_prof_est_copies, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") +
  labs(y = NULL) +
  guides(y = "none")

figure <- ggarrange(price, recognition, dif_work, reproduce, copies,
                     ncol = 1)

figure <- annotate_figure(figure,
                           bottom = text_grob("Diff. in AMCEs: Prof. - Popul.", size = 25),
                           top = text_grob("C. Difference between \nProfessionals - Popul.", size = 30, face = "bold"))

PAPER_POPULATION_PROFESSIONALS_AMCE_DIFF <- figure

###### COMBINED GRAPH PROFESSIONALS

### Figure 2 in the manuscript

FIGURE_2 <- ggarrange(PAPER_GENERAL_POPULATION_AMCE, NULL, 
                      PAPER_PROFESSIONALS_AMCE, NULL,
                      PAPER_POPULATION_PROFESSIONALS_AMCE_DIFF, 
                      nrow = 1, widths = c(1.1, 0.2, 1, 0.2, 1))

ggsave(FIGURE_2, file = "FIGURE_2.png", 
       width = 12, height = 12, scale = 1.3, bg = "white", dpi = 500)

### UK General population vs UK professionals ### UK General population vs UK professionals ### UK General population vs UK professionals
### UK General population vs UK professionals ### UK General population vs UK professionals ### UK General population vs UK professionals
### UK General population vs UK professionals ### UK General population vs UK professionals ### UK General population vs UK professionals
### UK General population vs UK professionals ### UK General population vs UK professionals ### UK General population vs UK professionals
### UK General population vs UK professionals ### UK General population vs UK professionals ### UK General population vs UK professionals

dataset_prof_pop_uk <- rbind(dataset_pop, dataset_prof_uk)

dataset_prof_pop_uk$sample <- as.factor(dataset_prof_pop_uk$sample) 

ftable(dataset_prof_pop_uk$sample)

amce_diff <- cj(dataset_prof_pop_uk, 
                selected ~ 
                  price + 
                  right_to_use_without_recognition +
                  right_to_issue_copies +
                  right_to_create_different_work +
                  right_to_reproduce, 
                by = ~ sample, 
                id = ~ responseid,
                estimate = "amce_diff")

amce_diff <- as.data.frame(amce_diff)

amce_diff <- amce_diff %>% mutate(attributes=ifelse(feature=="price", "Price",
                                                    ifelse(feature=="right_to_use_without_recognition", "Right to use without attribution",
                                                           ifelse(feature=="right_to_issue_copies", "Right to issue copies",
                                                                  ifelse(feature=="right_to_create_different_work", "Right to create derivative work",
                                                                         ifelse(feature=="right_to_reproduce", "Right to reproduce", NA))))))

amce_diff$attribute <- factor(amce_diff$attribute, levels = c("Price", 
                                                              "Right to use without attribution",
                                                              "Right to create derivative work",
                                                              "Right to reproduce",
                                                              "Right to issue copies"))

amce_diff <- amce_diff %>% mutate(levels=ifelse(level=="Nep" | level=="Ne" | level=="N" | level=="No", "No",
                                                ifelse(level=="Yep" | level=="Ye" | level=="Y" | level=="Yes", "Yes", 
                                                       ifelse(level==" 25", " 25",
                                                              ifelse(level==" 50", " 50", NA)))))

amce_diff$levels <- as.factor(amce_diff$levels)

amce_diff <- amce_diff %>% dplyr::rename(term=levels)
amce_diff <- amce_diff %>% dplyr::rename(conf.low=lower)
amce_diff <- amce_diff %>% dplyr::rename(conf.high=upper)

uk_pop_prof_est <- amce_diff

# Price attribute

uk_pop_prof_est_price <- uk_pop_prof_est %>% filter(feature=="price")

price <- ggcoef(uk_pop_prof_est_price, vline_color = "gray", conf.int = TRUE,
                mapping = aes(x = estimate, y = term), size = 8,
                vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Price") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_pop_prof_est_price, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") +
  labs(y = NULL) +
  guides(y = "none")

# Right for recognition

uk_pop_prof_est_recognition <- uk_pop_prof_est %>% filter(feature=="right_to_use_without_recognition")

recognition <- ggcoef(uk_pop_prof_est_recognition, vline_color = "gray", conf.int = TRUE,
                      mapping = aes(x = estimate, y = term), size = 8,
                      vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                      sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to use without attribution") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_pop_prof_est_recognition, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") +
  labs(y = NULL) +
  guides(y = "none")

# Right to create different work

uk_pop_prof_est_dif_work<- uk_pop_prof_est %>% filter(feature=="right_to_create_different_work")

dif_work <- ggcoef(uk_pop_prof_est_dif_work, vline_color = "gray", conf.int = TRUE,
                   mapping = aes(x = estimate, y = term), size = 8,
                   vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                   sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to create derivative work") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_pop_prof_est_dif_work, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") +
  labs(y = NULL) +
  guides(y = "none")

# Right to reproduce

uk_pop_prof_est_reproduce<- uk_pop_prof_est %>% filter(feature=="right_to_reproduce")

reproduce <- ggcoef(uk_pop_prof_est_reproduce, vline_color = "gray", conf.int = TRUE,
                    mapping = aes(x = estimate, y = term), size = 8,
                    vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                    sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to reproduce") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_pop_prof_est_reproduce, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") +
  labs(y = NULL) +
  guides(y = "none")

# Right to issue copies

uk_pop_prof_est_copies <- uk_pop_prof_est %>% filter(feature=="right_to_issue_copies")

copies <- ggcoef(uk_pop_prof_est_copies, vline_color = "gray", conf.int = TRUE,
                 mapping = aes(x = estimate, y = term), size = 8,
                 vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                 sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to issue copies") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(uk_pop_prof_est_copies, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") +
  labs(y = NULL) +
  guides(y = "none")

figure <- ggarrange(price, recognition, dif_work, reproduce, copies,
                     ncol = 1)

figure <- annotate_figure(figure,
                           bottom = text_grob("Diff. in AMCEs: Prof. - Popul.", size = 25),
                           top = text_grob("C. Difference between \nProfessionals - Popul.", size = 30, face = "bold"))

PAPER_POPULATION_PROFESSIONALS_AMCE_DIFF <- figure

###### COMBINED GRAPH UK POPULATION AND PROFESSIONALS

figure <- ggarrange(PAPER_GENERAL_POPULATION_AMCE, NULL, 
                      PAPER_UK_PROFESSIONAL_AMCE, NULL,
                      PAPER_POPULATION_PROFESSIONALS_AMCE_DIFF, 
                      nrow = 1, widths = c(1.1, 0.2, 1, 0.2, 1))

ggsave(figure, file = "FIGURE_A5.png", 
       width = 12, height = 12, scale = 1.3, bg = "white", dpi = 500)

# Differences Females vs Males# Differences Females vs Males# Differences Females vs Males
# Differences Females vs Males# Differences Females vs Males# Differences Females vs Males
# Differences Females vs Males# Differences Females vs Males# Differences Females vs Males
# Differences Females vs Males# Differences Females vs Males# Differences Females vs Males
# Differences Females vs Males# Differences Females vs Males# Differences Females vs Males

dataset_uk <- rbind(dataset_uk_prof, dataset_pop)

dataset_uk$sample <- as.factor(dataset_uk$sample) 

dataset_uk <- dataset_uk %>% filter(gender==1 | gender==2) %>% mutate(gender_dummy=ifelse(gender==1, "Male", "Female"))

dataset_uk$gender_dummy <- factor(dataset_uk$gender_dummy, levels = c("Male", "Female"))

amce_diff <- cj(dataset_uk, 
                selected ~ 
                  price + 
                  right_to_use_without_recognition +
                  right_to_issue_copies +
                  right_to_create_different_work +
                  right_to_reproduce, 
                by = ~ gender_dummy, 
                id = ~ responseid,
                estimate = "amce_diff")

amce_diff <- as.data.frame(amce_diff)

amce_diff <- amce_diff %>% mutate(attributes=ifelse(feature=="price", "Price",
                                                    ifelse(feature=="right_to_use_without_recognition", "Right to use without attribution",
                                                           ifelse(feature=="right_to_issue_copies", "Right to issue copies",
                                                                  ifelse(feature=="right_to_create_different_work", "Right to create derivative work",
                                                                         ifelse(feature=="right_to_reproduce", "Right to reproduce", NA))))))

amce_diff$attribute <- factor(amce_diff$attribute, levels = c("Price", 
                                                              "Right to use without attribution",
                                                              "Right to create derivative work",
                                                              "Right to reproduce",
                                                              "Right to issue copies"))

amce_diff <- amce_diff %>% mutate(levels=ifelse(level=="Nep" | level=="Ne" | level=="N" | level=="No", "No",
                                                ifelse(level=="Yep" | level=="Ye" | level=="Y" | level=="Yes", "Yes", 
                                                       ifelse(level==" 25", " 25",
                                                              ifelse(level==" 50", " 50", NA)))))

amce_diff$levels <- as.factor(amce_diff$levels)

amce_diff <- amce_diff %>% dplyr::rename(term=levels)
amce_diff <- amce_diff %>% dplyr::rename(conf.low=lower)
amce_diff <- amce_diff %>% dplyr::rename(conf.high=upper)

gen_est <- amce_diff

# Price attribute

gen_est_price <- gen_est %>% filter(feature=="price")

price <- ggcoef(gen_est_price, vline_color = "gray", conf.int = TRUE,
                mapping = aes(x = estimate, y = term), size = 8,
                vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Price") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(gen_est_price, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") 

# Right for recognition

gen_est_recognition <- gen_est %>% filter(feature=="right_to_use_without_recognition")

recognition <- ggcoef(gen_est_recognition, vline_color = "gray", conf.int = TRUE,
                      mapping = aes(x = estimate, y = term), size = 8,
                      vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                      sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to use without attribution") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(gen_est_recognition, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray")

# Right to create different work

gen_est_dif_work<- gen_est %>% filter(feature=="right_to_create_different_work")

dif_work <- ggcoef(gen_est_dif_work, vline_color = "gray", conf.int = TRUE,
                   mapping = aes(x = estimate, y = term), size = 8,
                   vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                   sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to create derivative work") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(gen_est_dif_work, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray")

# Right to reproduce

gen_est_reproduce<- gen_est %>% filter(feature=="right_to_reproduce")

reproduce <- ggcoef(gen_est_reproduce, vline_color = "gray", conf.int = TRUE,
                    mapping = aes(x = estimate, y = term), size = 8,
                    vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                    sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to reproduce") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(gen_est_reproduce, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") 

# Right to issue copies

gen_est_copies <- gen_est %>% filter(feature=="right_to_issue_copies")

copies <- ggcoef(gen_est_copies, vline_color = "gray", conf.int = TRUE,
                 mapping = aes(x = estimate, y = term), size = 8,
                 vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                 sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to issue copies") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(gen_est_copies, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") 

figure <- ggarrange(price, recognition, dif_work, reproduce, copies,
                     ncol = 1)

figure <- annotate_figure(figure,
                           bottom = text_grob("Diff. in AMCsE: Female - Male", size = 25),
                           top = text_grob("A. Gender \nDifferences", size = 30, face = "bold"))

PAPER_GENDER <- figure

# Differences lower vs higher educated# Differences lower vs higher educated# Differences lower vs higher educated
# Differences lower vs higher educated# Differences lower vs higher educated# Differences lower vs higher educated
# Differences lower vs higher educated# Differences lower vs higher educated# Differences lower vs higher educated
# Differences lower vs higher educated# Differences lower vs higher educated# Differences lower vs higher educated

dataset_uk <- rbind(dataset_uk_prof, dataset_pop)

dataset_uk$sample <- as.factor(dataset_uk$sample) 

dataset_uk <- dataset_uk %>% mutate(high_education=ifelse(education==2 | 
                                                            education==3 | 
                                                            education==4, "Higher educated", 
                                                          ifelse(education==1 | education==5, "Lower educated", NA))) %>%
  filter(high_education=="Higher educated" | high_education=="Lower educated")

dataset_uk$high_education <- factor(dataset_uk$high_education, levels = c("Lower educated", "Higher educated"))

amce_diff <- cj(dataset_uk, 
                selected ~ 
                  price + 
                  right_to_use_without_recognition +
                  right_to_issue_copies +
                  right_to_create_different_work +
                  right_to_reproduce, 
                by = ~ high_education, 
                id = ~ responseid,
                estimate = "amce_diff")

amce_diff <- as.data.frame(amce_diff)

amce_diff <- amce_diff %>% mutate(attributes=ifelse(feature=="price", "Price",
                                                    ifelse(feature=="right_to_use_without_recognition", "Right to use without attribution",
                                                           ifelse(feature=="right_to_issue_copies", "Right to issue copies",
                                                                  ifelse(feature=="right_to_create_different_work", "Right to create derivative work",
                                                                         ifelse(feature=="right_to_reproduce", "Right to reproduce", NA))))))

amce_diff$attribute <- factor(amce_diff$attribute, levels = c("Price", 
                                                              "Right to use without attribution",
                                                              "Right to create derivative work",
                                                              "Right to reproduce",
                                                              "Right to issue copies"))

amce_diff <- amce_diff %>% mutate(levels=ifelse(level=="Nep" | level=="Ne" | level=="N" | level=="No", "No",
                                                ifelse(level=="Yep" | level=="Ye" | level=="Y" | level=="Yes", "Yes", 
                                                       ifelse(level==" 25", " 25",
                                                              ifelse(level==" 50", " 50", NA)))))

amce_diff$levels <- as.factor(amce_diff$levels)

amce_diff <- amce_diff %>% dplyr::rename(term=levels)
amce_diff <- amce_diff %>% dplyr::rename(conf.low=lower)
amce_diff <- amce_diff %>% dplyr::rename(conf.high=upper)

edu_est <- amce_diff

# Price attribute

edu_est_price <- edu_est %>% filter(feature=="price")

price <- ggcoef(edu_est_price, vline_color = "gray", conf.int = TRUE,
                mapping = aes(x = estimate, y = term), size = 8,
                vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Price") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(edu_est_price, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") 

# Right for recognition

edu_est_recognition <- edu_est %>% filter(feature=="right_to_use_without_recognition")

recognition <- ggcoef(edu_est_recognition, vline_color = "gray", conf.int = TRUE,
                      mapping = aes(x = estimate, y = term), size = 8,
                      vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                      sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to use without attribution") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(edu_est_recognition, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray")

# Right to create different work

edu_est_dif_work<- edu_est %>% filter(feature=="right_to_create_different_work")

dif_work <- ggcoef(edu_est_dif_work, vline_color = "gray", conf.int = TRUE,
                   mapping = aes(x = estimate, y = term), size = 8,
                   vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                   sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to create derivative work") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(edu_est_dif_work, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray")

# Right to reproduce

edu_est_reproduce<- edu_est %>% filter(feature=="right_to_reproduce")

reproduce <- ggcoef(edu_est_reproduce, vline_color = "gray", conf.int = TRUE,
                    mapping = aes(x = estimate, y = term), size = 8,
                    vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                    sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to reproduce") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(edu_est_reproduce, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") 

# Right to issue copies

edu_est_copies <- edu_est %>% filter(feature=="right_to_issue_copies")

copies <- ggcoef(edu_est_copies, vline_color = "gray", conf.int = TRUE,
                 mapping = aes(x = estimate, y = term), size = 8,
                 vline_linetype =  "solid", errorbar_color = "black", errorbar_height = .3,
                 sort = c("ascending"), color = "black") +
  theme_grey() +
  ylab("") +
  xlab("") + 
  theme(axis.text.y = element_text(family="Times New Roman", size=25)) +
  theme(text = element_text(family="Times New Roman", size=20)) + 
  ggtitle("Right to issue copies") +
  theme(plot.title=element_text(family="Times New Roman", size=25, vjust = 2)) +
  theme(axis.line.y = element_line(colour = "white")) +
  theme(axis.ticks.y=element_blank()) +
  geom_text(data=subset(edu_est_copies, estimate!=0), mapping=aes(label=round(estimate, 3)),
            parse = TRUE, color="black", size=6, check_overlap = TRUE, 
            vjust = -1.5) +
  xlim(-0.2, 0.2) + 
  geom_vline(xintercept=0.50, color = "gray") 

figure <- ggarrange(price, recognition, dif_work, reproduce, copies,
                     ncol = 1)

figure <- annotate_figure(figure,
                           bottom = text_grob("Diff. in AMCEs: Higher - lower edu.", size = 25),
                           top = text_grob("B. Education \nDifferences", size = 30, face = "bold", just = "center"))

PAPER_EDUCATION <- figure

###### COMBINED GRAPH INDIVIDUAL LEVEL CHARACTERISTRICS

### Figure 4 in the manuscript

FIGURE_4 <- ggarrange(PAPER_GENDER, NULL, 
                      PAPER_EDUCATION,
                      nrow = 1, widths = c(1, 0.2, 1))

ggsave(FIGURE_4, file = "FIGURE_4.png", 
       width = 8, height = 12, scale = 1.3, bg = "white", dpi = 500)

######## Distributions of characteristics ######## Distributions of characteristics
######## Distributions of characteristics ######## Distributions of characteristics
######## Distributions of characteristics ######## Distributions of characteristics
######## Distributions of characteristics ######## Distributions of characteristics

# Input for Table 1 in the manuscript

### Age

dataset_pop$age <- as.numeric(dataset_pop$age)

mean(dataset_pop$age, na.rm = TRUE)

dataset_prof_uk$age <- as.numeric(dataset_prof_uk$age)

mean(dataset_prof_uk$age, na.rm = TRUE)

dataset_prof_us$age <- as.numeric(dataset_prof_us$age)

mean(dataset_prof_us$age, na.rm = TRUE)

### Gender

dataset_pop_gender <- dataset_pop %>% filter(gender==1 | gender==2) %>% mutate(gender_dummy=ifelse(gender==1, "Male", "Female"))

dataset_pop_gender$gender_dummy <- factor(dataset_pop_gender$gender_dummy, levels = c("Male", "Female"))

table(dataset_pop_gender$gender_dummy)

dataset_prof_uk_gender <- dataset_prof_uk %>% filter(gender==1 | gender==2) %>% mutate(gender_dummy=ifelse(gender==1, "Male", "Female"))

dataset_prof_uk_gender$gender_dummy <- factor(dataset_prof_uk_gender$gender_dummy, levels = c("Male", "Female"))

table(dataset_prof_uk_gender$gender_dummy)

dataset_prof_us_gender <- dataset_prof_us %>% filter(gender==1 | gender==2) %>% mutate(gender_dummy=ifelse(gender==1, "Male", "Female"))

dataset_prof_us_gender$gender_dummy <- factor(dataset_prof_us_gender$gender_dummy, levels = c("Male", "Female"))

table(dataset_prof_us_gender$gender_dummy)

### Education

dataset_pop$education <- as.numeric(dataset_pop$education)

dataset_prof_us$education <- as.numeric(dataset_prof_us$education)

dataset_prof_uk$education <- as.numeric(dataset_prof_uk$education)

dataset_pop_education <- dataset_pop %>% mutate(high_education=ifelse(education==2 | 
                                                            education==3 | 
                                                            education==4, "Higher educated", 
                                                          ifelse(education==1 | education==5, "Lower educated", NA)))

dataset_pop_education$high_education <- factor(dataset_pop_education$high_education, levels = c("Lower educated", "Higher educated"))

table(dataset_pop_education$high_education)

dataset_prof_uk_education <- dataset_prof_uk %>% mutate(high_education=ifelse(education==2 | 
                                                                        education==3 | 
                                                                        education==4, "Higher educated", 
                                                                      ifelse(education==1 | education==5, "Lower educated", NA)))

dataset_prof_uk_education$high_education <- factor(dataset_prof_uk_education$high_education, levels = c("Lower educated", "Higher educated"))

table(dataset_prof_uk_education$high_education)

dataset_prof_us_education <- dataset_prof_us %>% mutate(high_education=ifelse(education==2 | 
                                                                                education==3 | 
                                                                                education==4, "Higher educated", 
                                                                              ifelse(education==1 | education==5, "Lower educated", NA)))

dataset_prof_us_education$high_education <- factor(dataset_prof_us_education$high_education, levels = c("Lower educated", "Higher educated"))

table(dataset_prof_us_education$high_education)

### Figure A6

ggplot() +
  geom_density(data = dataset_prof_us, aes(x = age), color = "maroon", alpha = 0.4, fill = "maroon", adjust = 2) +
  geom_density(data = dataset_prof_uk, aes(x = age), color = "darkgreen", alpha = 0.4, fill = "darkgreen", adjust = 2) +
  geom_density(data = dataset_pop, aes(x = age), color = "lightblue", alpha = 0.4, fill = "lightblue", adjust = 2) +
  theme_classic() +
  labs(x = "Age", y = "Density") +
  annotate("text", x = 76, y = 0.03, label = "US Professionals", size = 3) +
  annotate("text", x = 50, y = 0.03, label = "UK Professionals", size = 3) +
  annotate("text", x = 30, y = 0.024, label = "UK General Population", size = 3)


ggsave("FIGURE_A6.png",
       height = 5,
       width = 10,
       dpi = 500,
       scale = 0.7)

### Figure A7

dataset_pop <- dataset_pop %>% mutate(education_cat = ifelse(education == 1, "Secondary education",
                                                             ifelse(education == 2, "Bachelor",
                                                                    ifelse(education == 3 | education==4, "Master/PhD",
                                                                           ifelse(education == 5, "Other", NA)))))

dataset_pop$education_cat <- factor(dataset_pop$education_cat, 
                                    levels = c("Secondary education",
                                               "Bachelor",
                                               "Master/PhD",
                                               "Other"))

dataset_prof_uk <- dataset_prof_uk %>% mutate(education_cat = ifelse(education == 1, "Secondary education",
                                                                     ifelse(education == 2, "Bachelor",
                                                                            ifelse(education == 3 | education==4, "Master/PhD",
                                                                                   ifelse(education == 5, "Other", NA)))))

dataset_prof_uk$education_cat <- factor(dataset_prof_uk$education_cat, 
                                        levels = c("Secondary education",
                                                   "Bachelor",
                                                   "Master/PhD",
                                                   "Other"))

dataset_prof_us <- dataset_prof_us %>% mutate(education_cat = ifelse(education == 1, "Secondary education",
                                                                     ifelse(education == 2, "Bachelor",
                                                                            ifelse(education == 3 | education==4, "Master/PhD",
                                                                                   ifelse(education == 5, "Other", NA)))))

dataset_prof_us$education_cat <- factor(dataset_prof_us$education_cat, 
                                        levels = c("Secondary education",
                                                   "Bachelor",
                                                   "Master/PhD",
                                                   "Other"))
ggplot() +
  geom_bar(data = dataset_prof_us, aes(y = (..count..)/sum(..count..), x = education_cat), color = "maroon", alpha = 0.4, fill = "maroon", just = -0.5, width = 0.1) +
  geom_bar(data = dataset_prof_uk, aes(y = (..count..)/sum(..count..), x = education_cat), color = "darkgreen", alpha = 0.4, fill = "darkgreen", just = 0.5, width = 0.1) +
  geom_bar(data = dataset_pop, aes(y = (..count..)/sum(..count..), x = education_cat), color = "lightblue", alpha = 0.4, fill = "lightblue", just = 1.5, width = 0.1) +
  scale_y_continuous(labels=scales::percent) +
  theme_classic() +
  labs(x = "Education levels", y = "Percentage") +
  annotate("text", x = 4.23, y = 0.355, label = "US Professionals", size = 3) +
  annotate("text", x = 4.23, y = 0.395, label = "UK Professionals", size = 3) +
  annotate("text", x = 4.35, y = 0.435, label = "UK General Population", size = 3) +
  annotate("rect", xmin = 3.5, xmax = 3.8, ymin = 0.42, ymax = 0.45, 
           fill = "lightblue", color = "lightblue", alpha = 0.4) +
  annotate("rect", xmin = 3.5, xmax = 3.8, ymin = 0.38, ymax = 0.41, 
           fill = "darkgreen", color = "darkgreen", alpha = 0.4) +
  annotate("rect", xmin = 3.5, xmax = 3.8, ymin = 0.34, ymax = 0.37, 
           fill = "maroon", color = "maroon", alpha = 0.4) 

ggsave("FIGURE_A7.png",
       height = 5,
       width = 10,
       dpi = 500,
       scale = 0.7)

##### END ##### END ##### END ##### END ##### END ##### END ##### END ##### END ##### 
##### END ##### END ##### END ##### END ##### END ##### END ##### END ##### END ##### 
##### END ##### END ##### END ##### END ##### END ##### END ##### END ##### END #####